from enum import Enum, member

class StatusCode(Enum):
    OK = 200
    BAD_REQUEST = 400
    UNAUTHORIZED = 401
    FORBIDDEN = 403
    NOT_FOUND = 404
    METHOD_NOT_ALLOWED = 405
    INTERNAL_SERVER_ERROR = 500
    BAD_GATEWAY = 502
    SERVICE_UNAVAILABLE = 503
    GATEWAY_TIMEOUT = 504

    def get_status_message(self, lang='cn'):
        if lang == 'en':
            return StatusENMessage[self.name].value
        return StatusCNMessage[self.name].value

  
class StatusENMessage(Enum):
    OK = 'OK'
    BAD_REQUEST = 'Bad Request'
    UNAUTHORIZED = 'Unauthorized'
    FORBIDDEN = 'Forbidden'
    NOT_FOUND = 'Not Found'
    METHOD_NOT_ALLOWED = 'Method Not Allowed'
    INTERNAL_SERVER_ERROR = 'Internal Server Error'
    BAD_GATEWAY = 'Bad Gateway'
    SERVICE_UNAVAILABLE = 'Service Unavailable'
    GATEWAY_TIMEOUT = 'Gateway Timeout'


class StatusCNMessage(Enum):
    OK = '成功'
    BAD_REQUEST = '请求错误'
    UNAUTHORIZED = '未认证'
    FORBIDDEN = '禁止访问'
    NOT_FOUND = '未找到'
    METHOD_NOT_ALLOWED = '方法不允许'
    INTERNAL_SERVER_ERROR = '服务器内部错误'
    BAD_GATEWAY = '网关错误'
    SERVICE_UNAVAILABLE = '服务不可用'
    GATEWAY_TIMEOUT = '网关超时'


if __name__ == '__main__':
    print(StatusCode.OK.value)
